package com.aj.activity.dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.aj.activity.R;

public class LogoutDialog extends BaseDialog {

	private TextView cannel_button;

	private TextView sure_button;

	private ILogoutInterface logoutInterface;

	public interface ILogoutInterface {
		public void sureLogout();
	}

	public LogoutDialog(Context context) {
		super(context, R.layout.dialog_logout);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		cannel_button = (TextView) findViewById(R.id.cannel_button);
		sure_button = (TextView) findViewById(R.id.sure_button);
		ClickEvent clickEvent = new ClickEvent();
		cannel_button.setOnClickListener(clickEvent);
		sure_button.setOnClickListener(clickEvent);
	}

	class ClickEvent implements View.OnClickListener {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.cannel_button:
				dismiss();
				break;
			case R.id.sure_button:
				if (logoutInterface != null) {
					logoutInterface.sureLogout();
				}
				dismiss();
				break;
			default:
				break;
			}
		}
	}

	public ILogoutInterface getLogoutInterface() {
		return logoutInterface;
	}

	public void setLogoutInterface(ILogoutInterface logoutInterface) {
		this.logoutInterface = logoutInterface;
	}

}
